﻿using System;
using System.Collections.Generic;
using System.Linq;
using AutoClub.Core.Dao.Support;
using AutoClub.Core.Domain;
using AutoClub.Core.Domain.Dao;

namespace AutoClub.Core.Dao.Implementations
{
    public class RaceRepo : BaseRepo<Guid, Race>, IRaceRepo
    {
        #region Constructor

        public RaceRepo(IUnitOfWork uof)
            : base(uof, (uof.Context as AutoClubDataContext).Races, new GuidIdentifierGenerator())
        {

        }

        #endregion


        public IEnumerable<RaceState> GetAllRaceStates()
        {
            return (this.Context as AutoClubDataContext).RaceStates.Where(rs => rs.Active).ToList();
        }

        public override IEnumerable<Race> GetAll()
        {
            return (this.Context as AutoClubDataContext).Races.Include("Category")
                .Include("State").ToList();
        }
    }
}
